<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../META-INF.resources/jquery/jquery-3.2.1.min.js"></script>
</head>
<body>

    <img style="width:47%;display:inline;"
         id="kaptcha" src="/images/kaptcha.jpg"
         title="点击更换"
         onclick="javascript:refreshCaptcha();"/>

</body>
</html>
<script type="application/javascript">
    function refreshCaptcha() {
        $("#kaptcha").attr("src","/images/kaptcha.jpg?t=" + Math.random());
    }
</script>